package com.jimmy.medical.repository;

import com.jimmy.medical.entity.Doctor;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface DoctorRepository extends JpaSpecificationExecutor<Doctor>, PagingAndSortingRepository<Doctor, Long> {

    @Query("select d from Doctor d left join d.department dep where dep.id=?1")
    public List<Doctor> findDoctorByDepartment(Long departmentId);
}
